package com.flexycore.iphone.launch;

import com.flexycore.iphone.uikit.UIApplication;
import com.flexycore.iphone.uikit.UIApplicationDelegate;
import com.flexycore.iphone.uikit.UINavigationController;
import com.flexycore.iphone.uikit.UIScreen;
import com.flexycore.iphone.uikit.UIViewController;
import com.flexycore.iphone.uikit.UIWindow;
import com.flexycore.iphone.view.WebViewController;

public class Launcher extends UIApplicationDelegate {

	private UIWindow window;
	private UIViewController viewController;
	private UINavigationController navigationController;

	private static final String URL = "http://www.flexycore.com";

	public void applicationDidFinishLaunching(UIApplication application) {
		// Build main window
		window = new UIWindow();
		window.initWithFrame(UIScreen.mainScreen().bounds());

		// Build the web view controller
		viewController = new WebViewController(URL);

		// Initialize the navigation controller with web view controller
		navigationController = new UINavigationController();
		navigationController.initWithRootViewController(viewController);

		// Add navigation controller's view to window
		window.addSubview(navigationController.view());
		
		// Show window
		window.makeKeyAndVisible();
	}
}
